﻿
@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/AdminInfo/Views/Shared/_LayoutPage1.cshtml";
}

<div class="container-fluid larry-wrapper">
    <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-12">
            <!--头部搜索-->
            <section class="panel panel-padding">
                <form class="layui-form" action="/AdminInfo/AdminProduct/ProductPage">
                    <div class="layui-form">
                        <div class="layui-inline">
                            <select name="ProductTypeID" id="ProductTypeID" lay-filter="ProductTypeID">
                                <option value="all" selected="">-- 请选择 --</option>
                                @{
                                    if (ViewBag.ProductType != null)
                                    {
                                        foreach (Gtkj.CMS.Model.ProductType item in ViewBag.ProductType)
                                        {
                                            <option value="@item.TypeID">@item.Name</option>
                                        }
                                    }

                                }
                            </select>
                        </div>
                            <div class="layui-inline">
                                <select name="ChchildProductTypeID" id="ChchildProductTypeID" lay-filter="ChchildProductTypeID">
                                    <option value="all" selected="">-- 请选择 --</option>
                                </select>
                            </div>
                        <div class="layui-inline">
                            <div class="layui-input-inline">
                                <input class="layui-input" name="KeyWord" placeholder="标题 / 藏主 ">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <div class="layui-input-inline">
                                <input class="layui-input start-date" name="StartDate" placeholder="开始日期">
                            </div>
                            <div class="layui-input-inline">
                                <input class="layui-input end-date" name="EndDate" placeholder="截止日期">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <button lay-submit class="layui-btn" id="sub" lay-filter="search">查找</button>
                        </div>
                    </div>
                </form>
            </section>
            <!--列表-->
            <section class="panel panel-padding">
                <div class="group-button">

                    <button class="layui-btn layui-btn-small modal-iframe" data-params='{"content": "/AdminInfo/AdminProduct/AddProduct", "title": "添加产品","full":"true"}'>
                        <i class="iconfont">&#xe649;</i> 添加
                    </button>
                    <button class="layui-btn layui-btn-small layui-btn-danger ajax-all" data-name="checkbox" data-params='{"url": "/AdminInfo/AdminProduct/ProductDel","data":"","confirm":"true"}'>
                        <i class="iconfont">&#xe626;</i> 删除
                    </button>
                </div>
                <div id="list" class="layui-form"></div>
                <div class="text-right" id="page"></div>
            </section>
        </div>
    </div>
</div>
<script>
    layui.use('list');
    layui.use('form', function () {
        var form = layui.form()
        $ = layui.jquery;
       
        form.on('select(ProductTypeID)', function (data) {
            $.getJSON("/AdminInfo/AdminProduct/ProductTypeChchild?TypeID=" + data.value, function (data) {
                var optionstring = "";
                $.each(data.data, function (i, item) {
                    optionstring += "<option value=\"" + item.TypeID + "\" >" + item.Name + "</option>";
                });
                $("#ChchildProductTypeID").html(optionstring);
                form.render('select'); //这个很重要
            });
        });
    })
</script>
<script id="list-tpl" type="text/html" data-params='{"url":"/AdminInfo/AdminProduct/ProductPage","pageid":"#page","dataName":"data","tableWidth":"2200px"}'>
    <table id="example" class="layui-table lay-even" lay-even="" data-name="articleData" data-tplid="list-tpl">
        <thead>
            <tr>
                <th width="30"><input type="checkbox" id="checkall" data-name="checkbox" lay-filter="check" lay-skin="primary"></th>
                <th>序号</th>
                <th>浏览次数</th>
                <th>父级</th>
                <th>子级</th>
                <th>标题</th>
                <th>藏主</th>
                
                <th>
                    收藏时间
                    <div class="order-box">
                        <a href="javascript:;" class="sort" data-filed="CollectionTime" data-order="asc"><i class="iconfont">&#xe615;</i></a>
                        <a href="javascript:;" class="sort down" data-filed="CollectionTime" data-order="desc"><i class="iconfont">&#xe647;</i></a>
                    </div>
                </th>
                <th>
                    创建时间
                    <div class="order-box">
                        <a href="javascript:;" class="sort" data-filed="CreateTime" data-order="asc"><i class="iconfont">&#xe615;</i></a>
                        <a href="javascript:;" class="sort down" data-filed="CreateTime" data-order="desc"><i class="iconfont">&#xe647;</i></a>
                    </div>
                </th>
                <th>
                    是否加急
                    <div class="order-box">
                        <a href="javascript:;" class="sort" data-filed="Isurgent" data-order="asc"><i class="iconfont">&#xe615;</i></a>
                        <a href="javascript:;" class="sort down" data-filed="Isurgent" data-order="desc"><i class="iconfont">&#xe647;</i></a>
                    </div>
                </th>
             
                <th>
                    是否首页会员区展示
                    <div class="order-box">
                        <a href="javascript:;" class="sort" data-filed="IsShowCollection" data-order="asc"><i class="iconfont">&#xe615;</i></a>
                        <a href="javascript:;" class="sort down" data-filed="IsShowCollection" data-order="desc"><i class="iconfont">&#xe647;</i></a>
                    </div>
                </th>
                <th>
                    首页分类区是否展示
                    <div class="order-box">
                        <a href="javascript:;" class="sort" data-filed="IsTop" istop-order="asc"><i class="iconfont">&#xe615;</i></a>
                        <a href="javascript:;" class="sort down" data-filed="IsTop" data-order="desc"><i class="iconfont">&#xe647;</i></a>
                    </div>
                </th>
                <th>
                    价格
                    <div class="order-box">
                        <a href="javascript:;" class="sort" data-filed="Money" data-order="asc"><i class="iconfont">&#xe615;</i></a>
                        <a href="javascript:;" class="sort down" data-filed="Money" data-order="desc"><i class="iconfont">&#xe647;</i></a>
                    </div>
                </th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            {{# layui.each(d.list, function(index, item){ }}
            <tr>
                <td><input type="checkbox" name="checkbox" value="{{ item.NewId}}" lay-skin="primary"></td>
                <td>{{ index+1 }}</td>
                <td>{{item.BrowseCount}}</td>
                <td>{{item.ParentName}}</td>
                <td>{{item.ChildName}}</td>
                <td>{{item.Title}}</td>
                <td>{{ item.CollectionName }}</td>
                <td>{{ item.CollectionTime }}</td>
                <td>{{ item.CreateTime }}</td>
                <td>{{ item.Isurgent }}</td>
                <td>{{ item.IsShowCollection }}</td>
                <td>{{ item.IsTop }}</td>
                <td>{{ item.Money }}</td>
                <td>
                    <button class="layui-btn layui-btn-mini modal-iframe" data-params='{"content": "/AdminInfo/AdminProduct/AddProduct?ID={{item.ProductID}}", "title": "{{item.Title}}","full":"true"}'>
                        <i class="iconfont">&#xe653;</i>查看产品
                    </button>
                    <button class="layui-btn layui-btn-mini layui-btn-danger ajax" data-list='{"key":"id={{ item.ProductID}}","msg":true,"render":"true","action":"del"}' data-params='{"url": "/AdminInfo/AdminProduct/ProductDel","data":"checkbox={{ item.ProductID}}&name=ni","confirm":"true"}'>
                        <i class="iconfont">&#xe653;</i>删除
                    </button>
                </td>
            </tr>
            {{# }); }}
        </tbody>
    </table>
</script>





